using System;
using System.Drawing;
using System.IO;
using OSC.Base;
using OSC.Twitter.Properties;

namespace OSC.Twitter
{
    public class OSCTwitterProvider : OSCProviderBase
    {
        #region Overrides of OSCProviderBase
        protected override bool FollowPerson { get { return false; } }
        protected override AuthenticationTypes AuthenticationType
        {
            get
            {
                return AuthenticationTypes.Forms;
            }
        }

        public override string Version
        {
            get { return "1.1"; }
        }
        public override int SynchRestartInterval
        {
            get { return 3600; }
        }
        public override string[] DefaultSiteUrls { get { return new[] { "http://www.twitter.com" }; } }
        public override byte[] SocialNetworkIcon
        {
            get { return GetProviderJpeg(); }
        }
        public override string SocialNetworkName
        {
            get { return "Twitter Outlook Social Connector"; }
        }
        public override Guid SocialNetworkGuid
        {
            get { return new Guid("7D18D39A-90C0-4A42-A7D5-42674396515B"); }
        }
        public override ISocialConnector CreateSession()
        {
            return new TwitterSocialConnector();
        }

        private byte[] GetProviderJpeg()
        {
            Image img = Resources.TwitterLogo;
            var imgMemoryStream = new MemoryStream();
            img.Save(imgMemoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
            var imgByteArray = imgMemoryStream.GetBuffer();
            return imgByteArray;
        }
        #endregion
    }
}